﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site/QuanTriHeThong/QuanTriHeThong_OffCanvas.Master" AutoEventWireup="true" CodeBehind="Kho_Khoa.aspx.cs" Inherits="HospitalManager.QuanTriHeThong.ThietLapHeThong.Kho_Khoa" %>

<%@ Register Src="ThietLapHeThong_LeftMenu.ascx" TagName="ThietLapHeThong_LeftMenu" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            $("#li_kho_khoa").addClass("active");
            $("#li_thietlaphethong").addClass("active");
        });

        function validation_form() {
            $("#<%=ddlKhoa.ClientID %>").rules("add", {
                required: true,
                messages: {
                    required: MsErrorEmpty
                }
            });
            $("#<%=ddlKho.ClientID %>").rules("add", {
                required: true,
                messages: {
                    required: MsErrorEmpty
                }
            });
            $("#<%=hfListKho.ClientID%>").val($("#<%=ddlKho.ClientID %>").selectpicker("val"));
        }

        var confirmed = false;
        function showconfirm(controlId) {
            if (confirmed) return true;
            bootbox.confirm("Bạn có chắc chắn xóa?", function (result) {
                if (result) {
                    if (controlId != null) {
                        var controlToClick = document.getElementById(controlId);
                        if (controlToClick != null) {
                            confirmed = true;
                            $("#form_Main").validate().cancelSubmit = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
    <uc1:ThietLapHeThong_LeftMenu ID="ThietLapHeThong_LeftMenu1" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="page-header" style="margin: 0 0 10px;">
                <h1 style="margin: 0; font-weight: bold; color: #3070A7; font-size: 30px;">
                    <small class="breadcrumb" style="font-size: 50%; background-color: #ffffff; padding: 0 15px;">
                        <li><a href="/he-thong/thiet-lap-he-thong">THIẾT LẬP HỆ THỐNG</a></li>
                        <li class="active">THIẾT LẬP KHO THUỘC KHOA</li>
                    </small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="form-horizontal">
            <div class="col-xs-3 col-md-3">
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        Khoa</label>
                    <div class="col-sm-9">
                        <asp:DropDownList ID="ddlKhoa" runat="server" data-live-search="true">
                        </asp:DropDownList>
                    </div>
                </div>
            </div>
            <div class="col-xs-3 col-md-3">
                <div class="form-group">
                    <label class="col-sm-3 control-label">
                        Kho</label>
                    <div class="col-sm-9">
                        <asp:DropDownList ID="ddlKho" runat="server" data-live-search="true" multiple data-selected-text-format="count">
                        </asp:DropDownList>
                    </div>
                </div>
            </div>
            <div class="col-xs-3 col-md-3">
                <div class="form-group">
                    <div class="col-sm-12">
                        <asp:Button ID="btnLuu" runat="server" Text="Lưu" CssClass="btn btn-info" OnClick="btnLuu_Click"
                            OnClientClick="validation_form()" />
                        <asp:Button ID="btnNhaplai" runat="server" Text="Nhập lại" CssClass="btn btn-warning"
                            OnClick="btnNhaplai_Click" OnClientClick="$('#form_Main').validate().cancelSubmit = true;" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row" style="margin-top: 10px;">
        <div class="col-md-12">
            <div class="form-group">
                <asp:GridView ID="gvDanhSach" runat="server" AutoGenerateColumns="False" Width="100%"
                    CssClass="table table-bordered table-condensed" OnRowDataBound="gvDanhSach_OnRowDataBound">
                    <Columns>
                        <asp:BoundField DataField="RowNumber" HeaderText="STT">
                            <ItemStyle HorizontalAlign="Center" Width="5%"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TenKhoa" HeaderText="Khoa"></asp:BoundField>
                        <asp:BoundField DataField="TenKho" HeaderText="Kho"></asp:BoundField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="btnDelete" runat="server" ToolTip="Xóa" CssClass="btn btn-danger btn-sm"
                                    CommandArgument='<%# Eval("ID") %>' OnClick="btnDelete_Click" OnClientClick="return showconfirm(this.id);">
                                        <i class="glyphicon glyphicon-trash"></i>
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
        </div>
        <div class="col-md-6" style="text-align: right;">
            <asp:DataList RepeatDirection="Horizontal" runat="server" ID="dlPager" OnItemCommand="dlPager_ItemCommand"
                CssClass="tbPage">
                <ItemTemplate>
                    <asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
                        CommandArgument='<%#Eval("Value") %>' CommandName="PageNo"></asp:LinkButton>
                </ItemTemplate>
            </asp:DataList>
        </div>
    </div>
    <asp:HiddenField ID="hfPageIndex" runat="server" Value="1" />
    <asp:HiddenField ID="hfListKho" runat="server" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FormContent" runat="server">
</asp:Content>
